package com.example.demo.util;

import org.jsoup.nodes.Element;

public class PageGenerator {
    public static String generate(Element pre,Element next){
        StringBuilder stringBuilder=new StringBuilder("<div class='layui-row' style=\"text-align:center; width:100%; \">");
        if(pre !=null &&  pre.attr("href").endsWith("html")){
            stringBuilder.append("<div class='layui-col-xs3 ' style='text-align:center; width:30%; '><a href-data='"+pre.attr("href")+"' class='story-menu-item layui-icon layui-icon-left' data-type = 2></a></div>");
        }
        String href = pre.attr("href");
        stringBuilder.append("<div class='layui-col-xs3' style='text-align:center; width:30%; '><a url='"+href.substring(0,href.lastIndexOf("/"))+"' class='menusearch back-menu layui-icon layui-icon-list' dataType = 1></a></div>");
        if(next !=null &&  next.attr("href").endsWith("html")){
            stringBuilder.append("<div class='layui-col-xs3' style='text-align:center; width:30%; '><a href-data='"+next.attr("href")+"' class='story-menu-item layui-icon layui-icon-right' data-type = 2></a></div>");
        }
        stringBuilder.append("</div>");
        return stringBuilder.toString();
    }


}
